Skip to content

Recover from failed OAuth token requests, and stop reusing refused tokens - #1496

Merged
frenck merged 1 commit into
mainfrom
frenck/oauth-recovery
Oct 10, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/oauth-recovery

Conversation

@frenck

@frenck frenck commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Proposed Changes

(Describe the changes and rationale behind them)

Found in a review, and reproduced. With OAuth client credentials, one failed token request made every later request fail the same way, as the failed attempt was kept and awaited again.

  • Forget a failed token request, so the next request tries again; and shield it, so a cancelled caller does not cancel it for the others waiting on it.
  • Do not load a token the API refused from the token storage again; get and store a new one instead.
  • Store a new token before using it, so concurrent requests never see a token without its expiry. With a slow token storage, that cancelled the token request.
  • Only forget the token on a 401. A 403 means it lacks the permission, or the billing plan lacks the feature, which a new token does not change.

Related Issues

(GitHub link to related issues or pull requests)

@frenck frenck added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Oct 10, 2026
@frenck
frenck merged commit 455288f into main Oct 10, 2026
33 checks passed
@frenck
frenck deleted the frenck/oauth-recovery branch October 10, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant